<template>
  <div class="xiangqing" >
    <div id="main" v-if="detail[0]">
      <el-page-header @back="goBack" content="详情页面"></el-page-header>
      <div id="txt">
        <h1>{{detail[0].upmenuTitle}}</h1>
        <a id="touxiang">
          <img :src="getPic(user[0].headPic)" />
          
          <span id="id">{{user[0].userName}}</span>
         
        </a>
      </div>

      <div id="comment">
        <div id="img">
          <img :src="getPic(detail[0].finishPic)" />
        </div>
        <div id="bz">
          <h4>{{detail[0].upmenuTitle}}的做法</h4>
        </div>
        <div id="buzhou">
          <ul>
            <li v-for="(i,key) in detail" :key="key">
              <div class="buzhoutu">
                <img :src="getPic(detail[key].stepPic)" />
              </div>
              <div class="wenzi">
                <div class="p">
                  <span class="shuzi">{{key+1}}</span>
                  <p>{{detail[key].stepMake}}</p>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div v-show='isShow'>
           
              <div class="block">
    <div class="wrap" style="background-image:url(../assets/images/404pic.jpg);">
      <div class="inner"> 
        <el-page-header @back="goBack" content="" id='elm'></el-page-header>
        <ul class="circle">
          <li class="tips"></li>
          <li class="ctext">
            <p id="err">404</p>
            <p id="err">ERROR</p>
            <p>很抱歉，</p>
            <p>
              你要访问的
              <b>页面</b>
            </p>
            <p>
              <strong>没有上传步骤</strong>
            </p>
          </li>
          <li>
            <router-link to="/index/home">返回首页&gt;</router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
    //   detail: null,
      user: [],
      detail: [],
      isShow:false
    };
  },
  created() {
    console.log(this.$route.params.upmenuId);
    var upmenuId = this.$route.params.upmenuId;
    this.$axios
      .get("http://localhost:3000/share/publishdetail/" + upmenuId)
      .then(res => {
       
        console.log('upmenuId',upmenuId)
        console.log("查询结果详情：", res.data);
        if(res.data.msg=="用户获取发布内容详情失败"){
          this.isShow = true
        }else{
          this.detail = res.data.data;
           console.log("detail数组", this.detail);
        }
      })
      .catch(err => {
        console.log("错误信息：", err);
      });
    //获取大share的头像
    this.$axios
      .get("http://localhost:3000/share/getshareuser/"+upmenuId)
      .then(res => {
        console.log("分享用户的信息", res.data.data);
        this.user = res.data.data;
      })
      .catch(err => {
        console.log("错误信息：", err);
      });
  },
  methods: {
    //返回上一级
    goBack() {
      this.$router.go(-1);
    },
    getPic(pic) {
      if (pic == "userimg.jpg") {
        return require("../assets/images/" + pic);
      } else {
        return require("../../../../Eatproj/EAT/public/upload/" + pic);
      }
    }
  }
};
</script>
<style>
html {
  overflow-y: auto;
}
/* body{
    overflow-y: hidden;
} */
</style>
<style lang='css' scoped>
#elm{
  color: aliceblue;
  
}
.myFooter{
  position:fixed;
  bottom: 0px;
}
.el-page-header{
  /* margin-top: 20px; */
}
#img{
  width: 85%;
  margin:0 auto;
}
/* html{
    overflow-y: hidden;
} */
* {
  margin: 0;
  padding: 0;
}
a {
  text-decoration: none;
}
li {
  list-style: none;
}
#big {
  width: 100%;
  min-width: 1200px;
  height: 100%;
}
#head {
  width: 80%;
  height: 80px;
  background-color: white;
  margin: 0 auto;
  /* background-color: yellow; */
}

#logo {
  /* background-color: red; */
  width: 30%;
  height: 80px;
  float: left;
  position: relative;
  left: 10px;
}

#headleft {
  width: 50%;
  float: left;
  height: 80px;
  /* background-color: yellow; */
}

#headleft1 {
  height: 80px;
  line-height: 80px;
}

#textword {
  width: 250px;
  height: 30px;
}

#textsearch {
  width: 50px;
  height: 35px;
  border: 1px solid #ccc;
  /* background: url(images/serach.jpg); */
}
/*背景图  */
#login {
  text-decoration: none;
  color: #407434;
}

#login img {
  width: 20px;
  height: 80px;
}

#headright {
  height: 80px;
  line-height: 80px;
  text-align: center;
}
/* 注销按钮 */
#loginName,
#unregister {
  display: none;
}
#unregister {
  height: 25px;
  width: 50px;
  border: none;
  outline: none;
  border-radius: 5px;
  background: linear-gradient(rgb(160, 191, 124), rgb(101, 147, 74));
  box-shadow: 0 0 3px rgb(64, 116, 52);
  cursor: pointer;
  color: white;
}
#bodynav {
  width: 100%;
  height: 60px;
  background-color: rgb(160, 190, 117);
  z-index: 2;
  /* background-color: red; */
}

#nav {
  width: 80%;
  height: 60px;
  margin: 0 auto;
  background-color: rgb(160, 190, 117);
  /* background-color:pink; */
}
#nav li {
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 20px;
  width: 20%;
  float: left;
}

#nav a {
  color: grey;
  font-weight: bold;
}

#nav a:hover {
  color: #407434;
  font-weight: bold;
}
/* 套餐下拉框 */
#choose {
  width: 100%;
  display: none;
}

#pep {
  list-style: none;
  /* margin-left:10%; */
  align-items: center;
  position: relative;
  left: 25%;
  z-index: 5;
}

#pep dd {
  width: 50%;
  height: 50px;
  line-height: 50px;
  background-color: rgb(230, 230, 230);
  font-size: 14px;
  position: relative;
}

#pep dd a {
  color: grey;
}
/* 健康饮食下拉框 */
#updown {
  width: 100%;
  display: none;
}
#up {
  list-style: none;
  position: relative;
  left: 25%;
  z-index: 5;
}
#up dd {
  width: 50%;
  height: 50px;
  line-height: 50px;
  background-color: rgb(230, 230, 230);
  font-size: 14px;
  position: relative;
}
#up dd a {
  color: grey;
}

/* 中间格式 */
#main {
  min-width: 1200px;
  width: 80%;
  margin: 0 auto;
  /* border: 1px solid black; */
  height: 100%;
  border-radius: 25px;
  float: left;
  position: relative;
  left: 50%;
  margin-left: -40%;
  /* justify-content: center; */
  /* background-color:white; */
  /* height: 2000px; */
}
#txt {
  position: relative;
  left: 50%;
  margin-left: -45%;
  margin-top: 30px;
  /* border: 1px solid red; */
  /* float: left; */
  width: 90%;
  /* display: flex; */
  /* flex-direction: column; */
}
#txt h1 {
  /* border: 1px solid black; */
  float: left;
  width: 50%;
  position: relative;
  left: 50%;
  /* top:-50%; */
  margin-left: -30%;
  /* align-items: center; */
  /* top: 50%; */
  margin-top: 1.5%;
  /* height: 80px; */
  font-size: 50px;
  /* align-items: center; */
}
#touxiang {
  float: right;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  width: 100px;
  /* border: 1px solid green; */
  margin-right: 15%;
}
#touxiang img {
  display: block;
  border-radius: 50%;
  border: 1px solid gray;
  height: 70px;
  width: 80%;
  margin: 0 auto;
  overflow: hidden;
}
#id {
  display: block;
  text-align: center;
  /* float: right; */
  /* border: 1px solid yellow;  */
  margin-bottom: 0px;
  width: 100%;
  margin: 0 auto;
  font-weight: bold;
}
#comment {
  margin-top: 50px;
  position: relative;
  left: 50%;
  margin-left: -45%;
  float: left;
  width: 90%;
  height: 100%;
  /* border: 1px solid gray; */
}
/* 大图 */
/* #img{
        /* border:1px solid purple; */

#img img {
  /* position: relative;
    left: 50%;
    margin-left: -30%; */
  width: 95%;
  height: 500px;
  /* margin:0 auto; */
}
#bz {
  margin-top: 35px;
  margin-left: 40px;
  font-size: 30px;
}
/* 步骤的DIV */
#buzhou {
  float: left;
  width: 100%;
  /* height: 500px; */
  /* border: 1px solid blue; */
  margin-top: 40px;
}
#buzhou li {
  height: 350px;

  margin-bottom: 40px;
  width: 100%;
  display: inline-block;
  position: relative;
  /* border: 1px solid black; */
}
#buzhou img {
  width: 100%;
  margin-left: 30px;
  height: 100%;
}
.buzhoutu {
  float: left;
  width: 50%;
  /* border: 1px solid pink; */
  height: 100%;
}

.wenzi {
  float: right;
  width: 400px;
  /* border:1px solid red; */
  height: 100%;
  display: flex;
}
.shuzi {
  border: 1px solid gray;
  border-radius: 50%;
  float: left;
  width: 40px;
  font-size: 30px;
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  left: 50%;
  margin-left: -20px;
}
.p {
  /* border: 1px solid blue; */
  margin: auto;
  float: left;
  width: 100%;
}
.wenzi p {
  font-size: 18px;
  font-weight: bold;
  float: left;

  width: 100%;
}

/* 底部 */
#bottom {
  width: 100%;
  height: 150px;
  margin-top: 0px;
  background-color: rgba(30, 30, 30, 0.4);
  justify-content: flex-end;
  float: left;
  /* position: absolute;
            bottom: 0px; */
}
#bottomtext {
  width: 80%;
  height: 150px;
  margin: 0 auto;
}
#bottomleft {
  float: left;
  width: 200px;
  height: 150px;
  position: relative;
  top: 10px;
}
#bottomrighttext a,
#bottomleft span,
#bottomrighttext span,
#bottomrighttext a {
  color: grey;
}
#bottomleft img {
  width: 200px;
  height: 80px;
}
#bottomright {
  width: 100%-200px;
  height: 150px;
}
#bottomrighttext {
  padding: 30px;
  position: relative;
  top: 40px;
  left: 30px;
}
#bottomrighttext a {
  text-decoration: none;
  margin-left: 15px;
}
h4 {
  font-size: 40px;
  color: firebrick;
}


/* 没有上传步骤图时的页面 */
.block{
  width: 100%;
  height: 800px;
  background: url(../assets/images/404pic.jpg) no-repeat;
  background-size: 100% 100%;
}
.wrap ul {
  padding-left: 150px;
  position: relative;
  top: 100px;
  left: 80px;
  width: 496px;
  height: 421px;
  padding-top: 60px;
  border-radius: 248px;
  overflow: hidden;
  background-color: rgba(251, 232, 26, 0.9);
}
.warp li {
  margin-left: 120px;
  width: 178px;
  margin: 0 auto;
  font-size: 16px;
  color: #000;
  line-height: 1em;
}

/* .warp li p{
    padding-bottom: 18px;
  } */
#err {
  font-size: 40px;
}
.warp li b {
  font-size: 22px;
  font-weight: normal;
}
.wrap li strong {
  font-size: 24px;
  font-weight: normal;
}
.wrap li a {
  font-size: 16px;
  color: #cc3300;
}
</style>